import React, { Component } from 'react';
import '../styles/Swipe.scss'
import * as service from '../api/index'
import { Swiper } from 'antd-mobile'

class Swipe extends Component {
    state = {
        bannerlist: []
    }
    async componentDidMount() {
        let res = await service.index_banner()
        // console.log(res.data.list);
        this.setState({bannerlist:res.data.list})
    }
    render() {
        return (
            <div className='swipe'>
                <Swiper autoplay loop autoplayInterval={2000}>
                    {
                        this.state.bannerlist.map((item,index)=>{
                            return (
                                <Swiper.Item key={index}>
                                    <img src={item.pic} alt="" />
                                </Swiper.Item>
                            )
                        })
                    }
                </Swiper>
            </div>
        );
    }
}

export default Swipe;